|
Eclipse Platform Pre-release 3.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.ui.ide.IDE
Collection of IDE-specific APIs factored out of existing workbench. This class cannot be instantiated; all functionality is provided by static methods and fields.
Nested Class Summary | |
static interface |
IDE.Preferences
Preferences defined by the IDE workbench. |
static interface |
IDE.SharedImages
Standard shared images defined by the IDE. |
Field Summary | |
static String |
EDITOR_ID_ATTR
An optional attribute within a workspace marker ( IMarker ) which
identifies the preferred editor type to be opened. |
static QualifiedName |
EDITOR_KEY
The persistent property key used on IFile resources to contain the preferred editor ID to use. |
static String |
RESOURCE_PERSPECTIVE_ID
The resource based perspective identifier. |
Method Summary | |
static List |
computeSelectedResources(IStructuredSelection originalSelection)
Extracts and returns the IResource s in the given
selection or the resource objects they adapts to. |
static IEditorDescriptor |
getDefaultEditor(IFile file)
Returns the default editor for a given file. |
static IMarkerHelpRegistry |
getMarkerHelpRegistry()
Returns the marker help registry for the workbench. |
static void |
gotoMarker(IEditorPart editor,
IMarker marker)
Sets the cursor and selection state for the given editor to reveal the position of the given marker. |
static IEditorPart |
openEditor(IWorkbenchPage page,
IFile input,
boolean activate)
Opens an editor on the given file resource. |
static IEditorPart |
openEditor(IWorkbenchPage page,
IMarker marker,
boolean activate)
Opens an editor on the file resource of the given marker. |
static void |
setDefaultEditor(IFile file,
String editorID)
Sets the default editor id for a given file. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final QualifiedName EDITOR_KEY
Example of retrieving the persisted editor id:
IFile file = ...
IEditorDescriptor editorDesc = null;
try {
String editorID = file.getPersistentProperty(EDITOR_KEY);
if (editorID != null) {
editorDesc = editorReg.findEditor(editorID);
}
} catch (CoreException e) {
// handle problem accessing persistent property here
}
Example of persisting the editor id:
IFile file = ...
try {
file.setPersistentProperty(EDITOR_KEY, editorDesc.getId());
} catch (CoreException e) {
// handle problem setting persistent property here
}
public static final String EDITOR_ID_ATTR
IMarker
) which
identifies the preferred editor type to be opened.
public static final String RESOURCE_PERSPECTIVE_ID
Method Detail |
public static IMarkerHelpRegistry getMarkerHelpRegistry()
public static void gotoMarker(IEditorPart editor, IMarker marker)
IGotoMarker
interface (either directly
or via IAdaptable.getAdapter
), this has no effect.
editor
- the editormarker
- the markerpublic static IEditorPart openEditor(IWorkbenchPage page, IFile input, boolean activate) throws PartInitException
If this page already has an editor open on the target file that editor is
brought to front; otherwise, a new editor is opened. If
activate == true
the editor will be activated.
An appropriate editor for the file input is determined using a multistep process.
IDE.EDITOR_KEY
containing the preferred editor id
to be used.IEditorRegistry.getDefaultEditor(String)
.
page
- the workbench page to open the editor ininput
- the file to editactivate
- if true
the editor will be activated
null
if external editor open
PartInitException
- if the editor could not be initializedpublic static IEditorPart openEditor(IWorkbenchPage page, IMarker marker, boolean activate) throws PartInitException
If this page already has an editor open on the marker resource file that
editor is brought to front; otherwise, a new editor is opened. If
activate == true
the editor will be activated. The cursor and
selection state of the editor are then updated from information recorded in
the marker.
If the marker contains an EDITOR_ID_ATTR
attribute
the attribute value will be used to determine the editor type to be opened.
If not, the registered editor for the marker resource file will be used.
page
- the workbench page to open the editor inmarker
- the marker to openactivate
- if true
the editor will be activated
null
not possible
PartInitException
- if the editor could not be initializedpublic static void setDefaultEditor(IFile file, String editorID)
getDefaultEditor(IFile)
.
file
- the filepublic static IEditorDescriptor getDefaultEditor(IFile file)
A default editor id may be registered for a specific file using
setDefaultEditor
. If the given file has a registered
default editor id the default editor will derived from it. If not,
the default editor is determined by taking the file name for the
file and obtaining the default editor for that name.
file
- the file
null
if not
foundpublic static List computeSelectedResources(IStructuredSelection originalSelection)
IResource
s in the given
selection or the resource objects they adapts to.
originalSelection
- the original selection, possibly empty
IResource
),
possibly empty
|
Eclipse Platform Pre-release 3.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |